import React, { Component } from 'react';
/*
  学习目标：Router的说明-使用history路由
*/

// 1. 导入BrowserRouter ,就是history路由
import { BrowserRouter as Router, Route, Link } from 'react-router-dom';

export default class App extends Component {
  render() {
    return (
      // 2. 使用BrowserRouter 替换hashRouter
      <Router>
        <Link to="/home">点我跳到home</Link>
        <br />
        <Link to="/my">点我跳到my</Link>
        <br />
        <Link to="/friend">点我跳到friend</Link>
        <Route path="/home" component={Home}></Route>
        <Route path="/my" component={My}></Route>
        <Route path="/friend" component={Friend}></Route>
      </Router>
    );
  }
}

function Home() {
  return <h1>我是Home组件</h1>;
}

function My() {
  return <h1>我是Find组件</h1>;
}
function Friend() {
  return <h1>我是Friend组件</h1>;
}
